#include "stm32f4xx_hal.h"
#include "stdint.h"
#include "stdio.h"
#include "DevicesSTM32ID.h"

char * pucSTM32IDRead(void)
{
    static uint8_t *pIDAddress = NULL, i = 0;
    static char ucSTM32IDBuff[25] = {0};

    if(i == 0)
    {
        pIDAddress = (uint8_t *)STM32_CHIP_ID_BASE;

        for(i = 0; i < 12; ++i)
            sprintf(&ucSTM32IDBuff[i * 2], "%02X", *pIDAddress++);
    }

    return ucSTM32IDBuff;
}

uint32_t uiSTM32TypeIDRead(void)
{
    uint32_t *puiDeviceIdAddr = NULL;

    puiDeviceIdAddr = (uint32_t*)(DEVICE_ID_REGISTER);

    return *puiDeviceIdAddr;
}
